<?php

class CustStockOut extends AppModel {
    var $name = 'CustStockOut';

    var $useTable = 'cust_stocks_out';

    const STOCK_OUT_TYPE = 'S';

    var $belongsTo = array('Product', 'CustProductSite',
        'CustStockOutHead' => array(
            'foreignKey' => 'cust_stock_out_head_id'
        ),
    );

    var $hasMany = array(
        'ProductSerial' => array(
            'foreignKey' => 'cust_stock_out_id',
            'conditions' => array(
                'cust_stock_out_type' => self::STOCK_OUT_TYPE
            )
        )
    );

    var $validate = array(
        'stock_out_qty' => array(
                'rule' => 'numeric',
                'message' => 'Please input stock out quantity',
                'on' => 'create'
        ),
    );
}
?>
